﻿using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace KLF.Lib.Browser.DOM.TypedArray
{
    public class GenericTypedArray<T> : ITypedArray<T>
    {
        public int BYTES_PER_ELEMENT;

        private GenericTypedArray()
        {
            BYTES_PER_ELEMENT = Marshal.SizeOf(typeof(T));
        }

        #region ITypedArray<T> Members

        public int length
        {
            get { return (buffer.byteLength / BYTES_PER_ELEMENT); }
        }

        public T get(int index)
        {
            int offset = index * BYTES_PER_ELEMENT;
            throw new NotImplementedException();
        }

        public void set(int index, T value)
        {
            int offset = index * BYTES_PER_ELEMENT;
            throw new NotImplementedException();
        }

        public T this[int index]
        {
            get
            {
                return get(index);
            }
            set
            {
                set(index, value);
            }
        }

        public ITypedArray<T> subarray(int begin)
        {
            throw new NotImplementedException();
        }

        public ITypedArray<T> subarray(int begin, int end)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IArrayBufferView Members

        public IArrayBuffer buffer
        {
            get { throw new NotImplementedException(); }
        }

        public int byteOffset
        {
            get { throw new NotImplementedException(); }
        }

        public int byteLength
        {
            get { throw new NotImplementedException(); }
        }

        #endregion
    }
}
